<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<%@ include file="/include/header.jsp"%>
<title><s:text name="reportDownload.titleT"/></title>
<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/checkIE.js"></script><!--检测IE-->
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />
<script>
function query(){
	var repRDA=document.getElementById("reportDownload.specifyRD").value;
	var monthValue = $("#select5").val();
	if(monthValue != ''){
		var yearValue = $("#select").val();
		if(yearValue == ''){
			alert(repRDA);
			return;
		}
	}
	var name = $("#textfield4").val();
	var year = $("#select").val();
	var month = $("#select5").val();
	//var url = "<%=request.getContextPath()%>/reportDownloadAction!input.action?query.month="+month+"&query.name="+name+"&query.year="+year;
	//alert(url);
	//window.location.href = url;
	$("#mainform").submit();
	
}

function download(id){
	var url = '<%=request.getContextPath() %>/reportDownloadAction!download.action?query.id='+id;
	//$("#mainform").attr('action',url);
	//$("#mainform").submit();
	window.location.href=url;
}

//function reloadSelf(){
	//var href = location.href.replace("?__rnd=","__rnd=").replace("&__rnd=","__rnd=").split("__rnd=")[0];
	//var rnd = (href.indexOf("?")>0 ? "&" : "?") + "__rnd=" + new Date().getTime();
	//window.location.href = href + rnd;
//}

$(function(){
	var queryNothingA=document.getElementById("reportDownload.queryNothingA").value;
	var queryFailA=document.getElementById("reportDownload.queryFailA").value;
	var downloadFailA=document.getElementById("reportDownload.downloadFailA").value;
	var fileNoFoundA=document.getElementById("reportDownload.fileNoFind").value;
	
	var year = '<%=request.getAttribute("query.year")%>';
	if(year != 'null'){
		$("#select").find("option").each(function(){
			var val = $(this).val();
			if(val == year){
				$(this).attr("selected","selected");
			}
			
		});
	}
	
	
	var status = '<%=request.getAttribute("status")%>';
	if(status == "empty"){
		alert(queryNothingA);
	}
	if(status == "selecterror"){
		alert(queryFailA);
	}
	if(status == "downloaderror"){
		alert(downloadFailA);
		query();
	}
	if(status == "filenotfound"){
		alert(fileNoFoundA);
		query();
	}
	
	
});


function selectYear(){
	var repRDA=document.getElementById("reportDownload.specifyRD").value;
	var year=$("#select").val();
	if(year==""){
		//$("#select5").val("请选择");
		$("#select5")[0].selectedIndex=0;//变为选择第一个
	}
}

function selectMonth(){
	var monthValue = $("#select5").val();
	if(monthValue != ''){
		var yearValue = $("#select").val();
		if(yearValue == ''){
			alert(repRDA);
			$("#select5")[0].selectedIndex=0;//变为选择第一个
			return;
		}
	}
	
}


function empty1(){
	$("#textfield4").val("");
	$("#select5").find("option").each(function(){
		var val = $(this).val();
		if(val ==''){
			$(this).attr("selected","selected");
		}
		
	});
	$("#select").find("option").each(function(){
		var val = $(this).val();
		if(val ==''){
			$(this).attr("selected","selected");
		}
		
	});
	
	
}

</script>

<style>
.form_down li.time{
	float:right;
	margin-right:10px;
	color:#A8A8B7;
}
</style>
</head>
<body >
<%@ include file="/include/home/home_header.jsp" %>
	<jsp:include page="/pages/system/feedback/feedback.jsp"></jsp:include>
	
 <div class="form_body">
 <div class="main_max">
 <div class="sideBar">
	<div class="box">
		<div class="location"><s:text name="share.currentL"/>：<s:text name="share.download"/> &gt; <s:text name="reportDownload.reportTitle"/></div>
	</div>
</div>
 
 <div class="form_table_tltle"><s:text name="reportDownload.title"/></div>
<form id="mainform" action="<%=request.getContextPath() %>/reportDownloadAction!input.action" method="post">
<input type="hidden" name="status" value="query"/>

<!-- internationalization  -->
<input type="hidden" id="reportDownload.specifyRD" value="<s:text name="reportDownload.specifyRD" />" />
<input type="hidden" id="reportDownload.queryNothingA" value="<s:text name="reportDownload.queryNothingA" />" />
<input type="hidden" id="reportDownload.queryFailA" value="<s:text name="reportDownload.queryFailA" />" />
<input type="hidden" id="reportDownload.downloadFailA" value="<s:text name="reportDownload.downloadFailA" />" />
<input type="hidden" id="reportDownload.fileNoFind" value="<s:text name="reportDownload.fileNoFind" />" />


<table width="0" border="0" cellpadding="0" cellspacing="0" class="form_table">
  <tr>
    <td class="left"><s:text name="reportDownload.reportName"/>：</td>
    <td><input type="text" name="query.name" id="textfield4" value="${query.name }" /></td>
    <td class="left"><s:text name="reportDownload.reportDate"/>：</td>
    <td><select name="query.year" id="select" onchange="selectYear()">
      <option value=""><s:text name="register.select"/></option>
	  <c:forEach begin="2000" end="2099" var="index" >
	  	<option  value="${index }">${index }</option>
	  </c:forEach>      
    </select>
      <s:text name="reportDownload.year"/>
       <select name="query.month" id="select5" onchange="selectMonth()">
        <option value=""><s:text name="register.select" /></option>
        <option value="01" <s:if test="query.month =='01'">selected="selected"</s:if>>1</option>
        <option value="02" <s:if test="query.month =='02'">selected="selected"</s:if>>2</option>
        <option value="03" <s:if test="query.month =='03'">selected="selected"</s:if>>3</option>
        <option value="04" <s:if test="query.month =='04'">selected="selected"</s:if>>4</option>
        <option value="05" <s:if test="query.month =='05'">selected="selected"</s:if>>5</option>
        <option value="06" <s:if test="query.month =='06'">selected="selected"</s:if>>6</option>
        <option value="07" <s:if test="query.month =='07'">selected="selected"</s:if>>7</option>
        <option value="08" <s:if test="query.month =='08'">selected="selected"</s:if>>8</option>
        <option value="09" <s:if test="query.month =='09'">selected="selected"</s:if>>9</option>
        <option value="10" <s:if test="query.month =='10'">selected="selected"</s:if>>10</option>
        <option value="11" <s:if test="query.month =='11'">selected="selected"</s:if>>11</option>
        <option value="12" <s:if test="query.month =='12'">selected="selected"</s:if>>12</option>
      </select>
      <s:text name="reportDownload.month"/></td>
  </tr>
</table>
<div class="form_but">
 <input value="" type="button"  onclick="query()" class="<s:i18n name='forms'><s:text name='forms.btn01'></s:text></s:i18n>"/>
 <input type="button" onclick="empty1()" value="" class="<s:i18n name='forms'><s:text name='forms.btn02'></s:text></s:i18n>"/>
</div>
</form>
<div class="high_10"></div>
<div class="form_table_tltle"><s:text name="share.queryResult"/></div>
 <div class="form_down">
 <c:if test="${not empty ruiList }">
	<c:forEach var="bean" items="${ruiList}" varStatus="stat">
		 <ul class="" onMouseOver="this.className='org'" onMouseOut="this.className='one'">
		 <li class="title">${bean.name }</li>
		 <li class="time"><s:text name="reportDownload.uploadTime"/>：${bean.uploadDate }</li>
		 <li class="cont">&nbsp;&nbsp;&nbsp;&nbsp;<label style="color:#32CD32"><s:text name="reportDownload.reportDate"/>：${bean.year} <s:text name="reportDownload.year"/> ${bean.month} <s:text name="reportDownload.month"/></label><br>
		 <a href="#">&nbsp;&nbsp;&nbsp;&nbsp;${bean.escribe }</a>
		 </li>
		 <li class="but">
		<%--  <input name="" onclick="download(${bean.id})" type="image" src="<%=request.getContextPath() %>/images/new/but_12.png" /> --%>
		 <input type="button" onclick="javascript:download(${bean.id});" value="" class="<s:i18n name='forms'><s:text name='forms.btn19'></s:text></s:i18n>" id=""/>
		 </li>
		 </ul>
		<div class="formline"></div>
	</c:forEach>
 </c:if>
 </div>
 <div class="list_page" style="height: 30px;">
 	<jsp:include page="../inc/pageComponent.jsp"></jsp:include>
 </div>
 </div>
 <div class="high_10"></div>
 
 <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 <div id="b_bottom">
<%--  <jsp:include page="../inc/footer2.jsp"></jsp:include> --%>
 <%@ include file="/include/home/home_footer.jsp" %> 
 </div>
 </div>
 
 

</body>
</html>

